-
Notifications
You must be signed in to change notification settings - Fork 7
Added tests of putPicturesInPage #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
jacekkopecky
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mostly just polishing
package.json
Outdated
| "multer": "^1.3.0", | ||
| "mysql2": "^1.5.1" | ||
| "mysql2": "^1.5.1", | ||
| "node-fetch": "^1.7.3" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this doesn't need to be there
examples/tests/client-tests.js
Outdated
| @@ -0,0 +1,173 @@ | |||
| 'use strict'; | |||
|
|
|||
| fetch = () => { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please include a comment on what we're doing here and why - hiding the original fetch
examples/tests/client-tests.js
Outdated
| const elM = document.querySelector('main'); | ||
| assert.strictEqual( | ||
| elM.childElementCount, | ||
| (0+baseMainChildrenNumber), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we might not need the (0+ ... ) bits here
| ); | ||
| assert.ok( | ||
| document.querySelector('main .picture') == null, | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
every assertion should have a message
examples/tests/client-tests.js
Outdated
|
|
||
| assert.strictEqual( | ||
| el.length, | ||
| (0), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't need () - basically everywhere please
examples/tests/client-tests.js
Outdated
| let images = as[0].querySelectorAll('img'); | ||
| let deletes = section.querySelectorAll('div'); | ||
|
|
||
| assert.ok( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this cannot fail
| 'The `<a>` element must have its `href` attribute set to the good value.', | ||
| ); | ||
|
|
||
| assert.strictEqual( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have a blank line before this block of tests, maybe add another line with a comment like
// test the image inside the a
examples/tests/client-tests.js
Outdated
| images = as[0].querySelectorAll('img'); | ||
| deletes = section.querySelectorAll('div'); | ||
|
|
||
| assert.strictEqual(listOfSections.length, 2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's better to actually repeat the messages from above because if any of these assertions fail, the developer won't be told why, what's going on
2fd380b to
ffc96df
Compare
ffc96df to
48ee7ad
Compare
|
Very good, thank you! We'll decide later how we'll use the PR on this repo. Please don't delete your fork. |
For each element created or modified by the function, we test :
before and after modification.
In three cases :